//
//  RightViewController.m
//  Project_2_weibo
//
//  Created by 林林 on 16/6/18.
//  Copyright © 2016年 lhn. All rights reserved.
//

#import "RightViewController.h"
#import "SendWeiboViewController.h"
#import "BaseNavigationController.h"

@interface RightViewController ()

@end

@implementation RightViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor cyanColor];
    //设置背景图片
    ThemeImageView *bgImageView = [[ThemeImageView alloc] initWithFrame:self.view.bounds];
    bgImageView.imageName = @"mask_bg.jpg";
    [self.view insertSubview:bgImageView atIndex:0];
    
    [self createButtons];
}

- (void)createButtons {
    
    //上面的按钮
    for (int i = 0; i < 5; i++) {
        
        CGRect frame = CGRectMake(10, 10 + i * (40 + 10), 40, 40);
        ThemeButton *button = [ThemeButton buttonWithType:UIButtonTypeCustom];
        button.frame = frame;
        NSString *fileName = [NSString stringWithFormat:@"newbar_icon_%i.png", i+1];
        button.imageName = fileName;
        button.tag = i;
        [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button];
    }
    
    //下面的按钮
    UIButton *locationButton = [UIButton buttonWithType:UIButtonTypeCustom];
    locationButton.frame = CGRectMake(10, kScreenHeight - 60 - 64 - 40, 40, 40);
    [locationButton setImage:[UIImage imageNamed:@"btn_map_location"] forState:UIControlStateNormal];
    [self.view addSubview:locationButton];
    
    UIButton *twoDCodeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    twoDCodeButton.frame = CGRectMake(10, kScreenHeight - 10 - 64 - 40, 40, 40);
    [twoDCodeButton setImage:[UIImage imageNamed:@"qr_btn"] forState:UIControlStateNormal];
    [self.view addSubview:twoDCodeButton];
    
}

- (void)buttonAction:(UIButton *)button {
    
    if (button.tag == 0) {
        SendWeiboViewController *send = [[SendWeiboViewController alloc] init];
        BaseNavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:send];
        [self presentViewController:nav animated:YES completion:^{
           
            [self.mm_drawerController closeDrawerAnimated:YES completion:nil];
        }];
    }
    
}

#pragma mark -
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
